﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using Model;
namespace UI
{
    public partial class 餐桌修改 : Form
    {
        public 餐桌修改()
        {
            InitializeComponent();
        }
        主界面 f;
        public 餐桌修改(主界面 f)
        {
            InitializeComponent();
            this.f = f;
        }
        private void 餐桌修改_Load(object sender, EventArgs e)
        {
            DataSet ds = 餐桌信息BLL.selectRoot();
            
            this.comtype.DataSource = ds.Tables[0];
            this.comtype.ValueMember = "RTID";
            this.comtype.DisplayMember = "RTName";
            foreach (DataRow item in ds.Tables[0].Rows)
            {
                if (item["RTName"].ToString() == 餐桌Model.RTID)
                {
                    comtype.Text = 餐桌Model.RTID;
                }
            }
            this.txtname.Text = 餐桌Model.TableName;
            this.txtArea.Text=餐桌Model.TableArea;

        }

        private void button1_Click(object sender, EventArgs e)
        {
            餐桌Model.TableName = this.txtname.Text;
            餐桌Model.RTID = this.comtype.SelectedValue.ToString();
            餐桌Model.TableArea = this.txtArea.Text;
            int count = 餐桌信息BLL.Upd();
            if (count > 0)
            {
                MessageBox.Show("修改成功");
                f.Zz();
                this.Close();
            }
            else {
                MessageBox.Show("修改失败");
            }
        }
    }
}
